package com.gyl.service.Impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.gyl.domain.PageListRes;
import com.gyl.domain.Place;
import com.gyl.domain.QueryVo;
import com.gyl.mapper.PlaceMapper;
import com.gyl.service.PlaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PlaceServiceImpl implements PlaceService {
    @Autowired
    private PlaceMapper placeMapper;
    @Override
    public PageListRes getAllPlace(QueryVo vo) {
        Page<Object> page = PageHelper.startPage(vo.getPage(),vo.getRows());
        List<Place> placeList = placeMapper.selectAll(vo);
        for (int i = 0; i <placeList.size() ; i++) {
            System.out.println(placeList.get(i));
        }
        PageListRes res = new PageListRes();
        res.setRows(placeList);
        res.setTotal(page.getTotal());
        return res;
    }
}
